package com.medicinemanager.ui;

import com.example.medicinemanager.R;
import com.medicinemanager.app.MedicineApp;
import com.medicinemanager.bean.Entity;
import com.medicinemanager.business.ShowStaffSource;
import com.medicinemanager.sql.StaffManager;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ManagerStaff extends BaseActivity {
	private final int RESOURCE = android.R.layout.simple_list_item_1;
	private MedicineApp mMedicineApp = null;
	private ShowStaffSource mShowStaffSource = null;
	private ListView mListView = null;	
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.data_view_activity);

		initAction();
	}

	public void onResume() {
		initView();
		super.onResume();
	}

	private void initAction() {
		mMedicineApp = (MedicineApp) getApplication();
		mShowStaffSource = new ShowStaffSource(ManagerStaff.this);
		mShowStaffSource.parseData();
	}

	private void initView() {
		mListView = (ListView) findViewById(R.id.lv_showdata);
		ArrayAdapter<Entity> entityAdapter = new ArrayAdapter<Entity>(this,
				RESOURCE, mMedicineApp.getStaffs());
		mListView.setAdapter(entityAdapter);
	}

	@Override
	public void gotoBack() {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		intent.setClass(ManagerStaff.this, MainActivity.class);
		ManagerStaff.this.startActivity(intent);
	}

	@Override
	public void gotoAhead() {
		// TODO Auto-generated method stub

	}
}
